<?php

namespace app\tours\model;

use think\model\Relation;

class ToursCounsel extends Relation {

       protected $link = array(
	    'tours' => array(
		'mapping_type' => BELONGS_TO,
		'class_name' => 'Tours',
		'foreign_key' => 'tours_id',
		'mapping_fields' => 'title,price,id as tours_id',
		'as_fields' => 'title,price,tours_id',
		'parent_key' => 'id'
	    )
	);

	protected function _after_select(&$resultSet, $options=array()) {
		parent::_after_select($resultSet, $options);
		foreach ($resultSet as $key => $value) {
			$resultSet[$key]['url'] = U("/xianlu/" . $value['tours_id'], '', 'html', 'www');
		}
	}

}
